<template>
	<list-scroll class="list-scroll box-b" @loadmore="loadmore" >
		<list-card v-for="(item,index) in list" :key="index" :index="index" :item="item"></list-card>
		<uni-load-more :status="load.loading||'loading'" iconType="snow" :contentText="contentText" v-if="list.length>0||load.loading=='loading'"></uni-load-more>
		<!-- <u-empty :text="contentText.noRecord" v-else></u-empty> -->
		<view class="flex flex-column align-center justify-around font-size-14 font-color-999" v-else>
			{{contentText.noRecord}}
		</view>
	</list-scroll>
</template>

<script>
	import listScroll from '@/components/list-scroll/list-scroll.vue'
	import listCard from '@/components/list-card/list-card-child.vue'
	import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'
	export default{
		components:{
			listScroll,
			listCard,
			uniLoadMore,
		},
		props:{
			list:{
				type:Array,
				default(){
					return []
				}
			},
			load:{
				type:Object,
				default(){
					return {
						loading:'loading'
					}
				}
			}
		},
		data(){
			return {
				isShowModel:false,
				contentText:{
					contentdown: 'Pull up get more',
					contentrefresh: '加载中...',
					contentnomore: '没有更多数据了',
					noRecord:'暂无数据'
				}
			}
		},
		created() {
			// uni.$on('deleteItemEvent',(item)=>{
			// 	console.log("item",item)
			// })
		},
		/* watch:{
			load(newVal){
				console.log('==load==',newVal);
			},
			list(newVal){
				console.log('==list.len==',newVal.length);
			}
		}, */
		methods:{
			loadmore(val){
				console.log("loadmore",val)
				this.$emit('listloadmore',val)
			},
			openPop(item){
				console.log('item',item)
				this.$refs.popup.open()
				this.isShowModel = true
			},
			close() {
				// TODO 做一些其他的事情，before-close 为true的情况下，手动执行 close 才会关闭对话框
				// ...
				this.$refs.popup.close()
			},
			/**
			 * 点击确认按钮触发
			 * @param {Object} done
			 * @param {Object} value
			 */
			confirm(value) {
				// 输入框的值
				console.log(value)
				// TODO 做一些其他的事情，手动执行 close 才会关闭对话框
				// ...
				this.$refs.popup.close()
			}
		}
	}
</script>

<style >
	.list-scroll{
		height: 100%;
		padding: 12rpx 20rpx;
	}
	.maskBox{
	    position: fixed;
	    top:0;
		bottom: 0;
		left: 0;
		right: 0;
	    background-color: rgba(0, 0, 0, .8);
	    user-select: none;
	    z-index: 1001;
	}
	.modelBox{
		width: 80%;
		padding: 50rpx 24rpx;
		position: relative;
	}
	.submitBtn{
		width: 70%;
		height: 80rpx;
		line-height: 80rpx;
		border-radius: 40rpx;
	}
</style>
